<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8" />
    <title>PicBed</title>
    <meta name="generator" content="EverEdit" />
    <meta name="author" content="" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
    <link rel="Bookmark" href="./favicon.ico" />
    <link rel="stylesheet" href="./static/layui/css/layui.css">
    <link rel="stylesheet" href="./static/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="./static/style.css">
    <script src="./static/jquery.min.js"></script>

</head>

<body>
    <div id="left-gg"></div>
    <div id="right-gg"></div>
    <!-- 顶部导航栏 -->
    <div class="header">
        <div class="layui-container">
            <div class="layui-row">
                <div class="layui-col-lg12">
                    <div class="left-menu">
                        <a href="/">
                            <div id="logo">
                                <!-- <img src="./static/images/logo.png"> -->
                            </div>
                        </a>
                    </div>
                    <div class="layui-hide-xs menu">
                        <!-- <ul class="layui-nav" lay-filter="">
                            <li class="layui-nav-item">
                                <a href="javascript:;" onclick="switchMainPage('index')">
                                    <i class="layui-icon layui-icon-home"></i> 首页
                                </a>
                            </li>
                            <li class="layui-nav-item">
                                <a href="javascript:;" onclick="switchMainPage('multiple-image')">
                                    <i class="layui-icon layui-icon-upload"></i> 多图上传
                                </a>
                            </li>
                            <li class="layui-nav-item">
                                <a href="javascript:;" onclick="switchMainPage('images')">
                                    <i class="layui-icon layui-icon-picture"></i> 图床预览
                                </a>
                            </li>
                            <li class="layui-nav-item">
                                <a href="javascript:;" onclick="switchMainPage('images')">
                                    <i class="layui-icon layui-icon-search"></i> 探索发现
                                </a>
                            </li>
                            <li class="layui-nav-item">
                                <a href="javascript:;" onclick="switchMainPage('login')">
                                    <i class="layui-icon layui-icon-templeate-1"></i> 登录/注册
                                </a>
                            </li> -->
                        <!-- <li class="layui-nav-item">
                                <a href="javascript:;" target="_blank" rel="nofollow"><i
                                        class="layui-icon layui-icon-tabs"></i> 其它选项</a>
                                <dl class="layui-nav-child">
                                    二级菜单
                                    <dd><a href="https://dwz.ovh/imgurldoc" rel="nofollow" target="_blank">帮助文档</a></dd>
                                    <dd><a href="/home/log" rel="nofollow" target="_blank">更新日志</a></dd>
                                    <dd><a href="https://github.com/helloxz/imgurl" rel="nofollow"
                                            target="_blank">源码下载</a></dd>
                                </dl>
                            </li> -->
                        <!-- 简单判断用户是否登录 -->
                        <!-- <li class="layui-nav-item">
                                <a href="/admin/index">
                                    <i class="layui-icon layui-icon-console"></i> 后台管理
                                </a>
                            </li> -->
                        <!-- 简单判断用户是否登录END -->
                        <!-- </ul> -->
                    </div>
                    <!-- <div class="menu layui-hide-lg layui-hide-md layui-hide-sm">
                        <ul class="layui-nav" lay-filter="">
                            <li class="layui-nav-item"><a href="/found"><i class="layui-icon layui-icon-search"></i>
                                    发现</a></li>
                        </ul>
                    </div> -->
                </div>
            </div>
        </div>
    </div>
    <!-- 顶部导航栏END -->

    <!-- 页面主体内容部分 start -->
    <section id="section">

    </section>


    <!-- 页面内容部分 end -->





    <!-- 底部 -->

    <!-- 底部END -->
    <script src="./static/layui/layui.js"></script>
    <script src="./static/picbed.js"></script>
    <script src="./static/clipBoard.min.js?v=1.40"></script>
    <!--Ctrl + V粘贴上传-->
    <script src="./static/js/PasteUpload.js"></script>
    <script src="./static/js/common.js"></script>
    <script>
        // $('#section').load('./single-image.html');
        $('#section').load('./multiple-image.html');

        function switchMainPage(file, action = null) {
            if (action == 'logout') {
                logout();
            } else {
                localStorage.setItem('auth', action);
                $('#section').load('./' + file + '.html');
            }
        }


        // 渲染顶部导航菜单
        var str = `
            <ul class="layui-nav" lay-filter="">
                <li class="layui-nav-item">
                    <a href="/">
                        <i class="layui-icon layui-icon-home"></i> 首页
                    </a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" onclick="switchMainPage('multiple-image')">
                        <i class="layui-icon layui-icon-upload"></i> 多图上传
                    </a>
                </li>`;
        if (window.config.token) {
            str += `<li class="layui-nav-item">
                    <a href="javascript:;" onclick="switchMainPage('images', 'user')">
                        <i class="layui-icon layui-icon-picture"></i> 图床预览
                    </a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" onclick="switchMainPage('images', 'guest')">
                        <i class="layui-icon layui-icon-find-fill"></i> 探索发现
                    </a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" rel="nofollow">
                        <img src="${localStorage.getItem('avatar')}" style="width:30px;height:30px;">
                        <i class="layui-icon"></i> ${localStorage.getItem('username')}
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" onclick="switchMainPage('login', 'logout')" rel="nofollow">退出登录</a></dd>
                        <dd><a href="javascript:;" onclick="switchMainPage('reset-password')" rel="nofollow">重置密码</a></dd>
                    </dl>
                </li>
            </ul>`;
        } else {
            str += `<li class="layui-nav-item">
                    <a href="javascript:;" onclick="switchMainPage('images', 'guest')">
                        <i class="layui-icon layui-icon-search"></i> 探索发现
                    </a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" onclick="switchMainPage('login')">
                        <i class="layui-icon layui-icon-templeate-1"></i> 登录/注册
                    </a>
                </li>
            </ul>`;
        }
        $('.menu').html(str);


        function logout() {
            localStorage.clear();
            window.location.href = './index.html';
            $.ajax({
                url: window.config.api_url + 'api/logout',
                method: 'get',
                data: {},
                dataType: 'json',
                processData: true,
                cache: false,
                headers: { token: window.config.token, rtime: window.func.getTime() },
                success: function (res) {

                },
                fail: function () {

                }
            });
        }



    </script>
    <!--粘贴上传END-->
</body>

</html>